﻿@using System.Collections
@model IEnumerable<MMSWebsite.Models.Customer>

<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.CompanyNm)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Code)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IdCode)
        </th>
        <th>
            @Html.DisplayName("Address")
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Phone)
        </th>
        <th>
        </th>
    </tr>
    
    @{
        //paramater to use for color row in table show
        var OddColor = "#DDEEEE";
        var evenColor = "#EEFFFF";
        var Odd = OddColor;
        int i = 0;
    }
@foreach (var item in Model)
{
    //Check Customer has FV or not, if not -> value columns Responsibility = Empty 
    var valueResEmp = string.Empty; 
    if (item.ResponsibleEmp != null)
    {
        valueResEmp = item.ResponsibleEmp.Employee.Name;//valueResEmp is used to set default value for Dropdownlist Responsibility
    }
    //----------------------------------------------------------------------------
    
    <tr bgcolor="@Odd">
        <td>
            @Html.DisplayFor(modelItem => item.CompanyNm)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Code)
        </td>
        <td>
            <a href="@Url.Action("Details", "CusMgn", new {id = @item.Id})" style=" color: darkCyan; font-weight: bold">@Html.DisplayFor(modelItem => item.Name)</a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IdCode)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.NumberAddress) , 
            @Html.DisplayFor(modelItem => item.Area.DistrictName) , 
            @Html.DisplayFor(modelItem => item.Area.CityName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Phone)
        </td>
        <td>
            <a href="@Url.Action("Edit", "CusMgn", new {id = @item.Id})">Edit</a>
        </td>
        
    </tr>
    i++;
    Odd = Odd == OddColor ? evenColor : OddColor;
}

</table>
